package com.example.config.reciver;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;


@Component
public class TopicReceiver {
    @RabbitListener(queues = "topic.stock1")
    @RabbitHandler
    @SendTo("topicQueue1")
    public String comsumeDirectQueue(String message){
        System.out.println("topic1消费者收到消息:" + message);
        return "SUCCESS1";
    }

    @RabbitListener(queues = "topic.stock2")
    @RabbitHandler
    @SendTo("topicQueue2")
    public String comsumeDirectQueue2(String message){
        System.out.println("topic2消费者收到消息:" + message);
        return "SUCCESS2";
    }
}
